<?php
/**
* @version $Id: Catsims.class.php 10002 2008-02-08 10:56:57Z willebil $
* @package Joomla
* @subpackage Catsims
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

/**
* Category database table class
* @package Joomla
* @subpackage Catsims
*/
class mosCatphone extends mosDBTable {
	/** @var int Primary key */
	var $id					= null;
	var $name				= null;		
	var $img				= null;	
	var $ordering			= null;
	var $published			= null;
	var $parentid			= null;		var $sectionid			= null;
	var $color				= null;
	var $show				= null;
	var $vote				= null;

	/**
	* @param database A database connector object
	*/
	function mosCatphone( &$db ) {
		$this->mosDBTable( '#__catphone', 'id', $db );
	}
	//Viet ham de quy cay thu muc <select>/<option>
	function listCategory($parentid=0,$insert_text=""){
		$sql = "SELECT * FROM jos_catphone WHERE published=1 AND parentid=".$parentid." ORDER BY parentid";
		$rs = mysql_query($sql);
		if(!$rs){
			die("Cannot Query !");	
		}
		while ($arr = mysql_fetch_array($rs,MYSQL_ASSOC))
		{
			echo"<option value='".$arr['id']."'>$insert_text".$arr['name']."</option>";	
			$this->listCategory($arr['id'],$insert_text."-----");
		}
	}	
}
?>